<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="./js/vue.js"></script>
    
</head>
<body>
    <script type="text/javascript">
        let number = 18;
        let person = {
            name:'张三',
            sex:'男',
        }
        Object.defineProperty(person,'age',{
            // value:18,// 不能遍历
            // enumerable:true,// 这样就可以遍历，默认是FALSE
            // writable:true,// 属性可以被修改
            // configurable:true,// 是否可以被删除
            get(){
                // d当调用age属性时，调用get函数，返回age的值
                return number;
            },
            set(value){
                console.log("有人修改了age属性");
                number = value;
            }
        })
        // console.log(person);
    </script>
</body>
</html>